package com.lagou.edu.controller;

import com.lagou.edu.service.AuthCodeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by shixi  on 2021/1/28
 */
@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private AuthCodeServiceImpl authCodeService;

    /**
     * ⽣成验证码并发送到对应邮箱，成功true，失败 false
     * @param email
     * @return
     */
    @RequestMapping("/create/{email}")
    public boolean create(@PathVariable(value = "email") String email){
        return authCodeService.createAndSend(email);
    }
}